package cn.lf.android.lawfirm.inputsource;

import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.zhy.autolayout.AutoRelativeLayout;

import cn.lf.android.lawfirm.BaseActivity;
import cn.lf.android.lawfirm.R;
import cn.lf.android.lawfirm.utils.KeyBoardUtils;

/**
 * 对方当事人页
 * Created by Administrator on 2017/8/7.
 */

public class OpposingPartyActivity extends BaseActivity {
    private TextView mTitle;
    private ImageView mImg_Left;
    private TextView mSave;
    private EditText mName;

    @Override
    public Object getContentResView() {
        return R.layout.activity_opposing_party;
    }

    @Override
    public void initView() {
        initTitle();
        mName = (EditText) findViewById(R.id.et_opposing);
    }

    @Override
    public void initData() {
//        AutoRelativeLayout refreshLayout = (AutoRelativeLayout)findViewById(R.id.refreshLayout);
//        refreshListeners(refreshLayout);
    }

    private void initTitle() {
        mTitle = ((TextView) findViewById(R.id.eb_tv_title));
        mTitle.setText("对方当事人");
        mImg_Left = ((ImageView) findViewById(R.id.img_left));
        mImg_Left.setVisibility(View.VISIBLE);
        mImg_Left.setOnClickListener(this);
        mSave = ((TextView) findViewById(R.id.eb_tv_right));
        mSave.setOnClickListener(this);
        mSave.setVisibility(View.VISIBLE);
        mSave.setText("确认");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.img_left:
                hintKbTwo();
                finish();
                break;
            case R.id.eb_tv_right:
                hintKbTwo();
                if (mName.getText().toString().trim().length() > 0) {
                    Intent intent = new Intent();
                    intent.putExtra("party", mName.getText().toString().trim());
                    setResult(RESULT_OK, intent);
                    finish();
                } else {
                    showCToast("请填写对方当事人");
                }
                break;
            default:
                break;
        }
    }
    // 隐藏输入键盘
    public void hintKbTwo() {
        KeyBoardUtils.closeKeybord(mName, this);
    }
}

